package com.zy.web.controller.business;

import com.zy.business.domain.TbProjectFollow;
import com.zy.business.service.ProjectFollowService;
import com.zy.common.annotation.RepeatSubmit;
import com.zy.common.core.controller.BaseController;
import com.zy.common.core.domain.AjaxResult;
import com.zy.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: 客户跟进管理
 * @author: whf
 * @create: 2023-02-24 10:01
 **/
@RestController
@Api(tags = "客户跟进记录接口")
@RequestMapping("/follow")
public class ProjectFollowController extends BaseController {

    @Autowired
    private ProjectFollowService projectFollowService;

    @ApiOperation(value = "添加跟进记录")
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody TbProjectFollow projectFollow) {
        projectFollow.setCreateBy(getUsername());
        return toAjax(projectFollowService.add(projectFollow));
    }

    @ApiOperation(value = "获取跟进记录列表")
    @GetMapping("/list")
    public TableDataInfo list(@RequestParam Long projectId) {
        startPage();
        List<TbProjectFollow> operationLogList = projectFollowService.selectList(projectId);
        return getDataTable(operationLogList);
    }

}
